package com.atguigu.rpc.demo;

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.Socket;

/**
 * RPC master demo
 *
 * @Author 剧情再美终是戏
 * @Date 2020/1/3
 * @return
 * @Version 1.0
 **/
public class Master {

    public static void main(String[] args) throws IOException {

        // 连接客户端
        Socket socket = new Socket("localhost", 9999);

        // 创建writer对象
        PrintWriter printWriter = new PrintWriter(new OutputStreamWriter(socket.getOutputStream(), "UTF-8"));

        // 发送执行命令
        printWriter.write("CMD /c notepad");

        // 关闭资源
        printWriter.flush();
        printWriter.close();
    }
}
